﻿
using System;
using System.Collections;
using System.Collections.Generic;

public class LuaObject
{
    private ObjectInfo _objectInfo;

    public string Address { get; set; }
    public string NodeStr { get; set; }
    public bool Marked { get; set; }

    // 引用处
    public int Ref
    {
        get { return _objectInfo.Parents.Count + _objectInfo.Upvalues.Count; }
    }

    // Table有几个元素
    public int ChildCount
    {
        get { return _objectInfo.Count; } 
    }

    public double Size
    {
        get { return _objectInfo.Size; }
    }

    public int Type
    {
        get { return _objectInfo.Type; }
    }

    public LuaObject(string address, ObjectInfo objectInfo)
    {
//        Address = Convert.ToUInt64(address).ToString("X");
        Address = address;
        _objectInfo = objectInfo;
    }

    public Dictionary<string,string> GetChilds()
    {
        return _objectInfo.Childs;
    }

    public Dictionary<string, string> GetUpvalues()
    {
        return _objectInfo.Upvalues;
    }

    public Dictionary<string, string> GetParents()
    {
        return _objectInfo.Parents;
    } 
}


